import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './vuex/store'
import './registerServiceWorker'
import axios from '@/utils/axios'
import 'reset-css'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css';
import '@/mixins/mixins'

Vue.use(ElementUI)
import 'font-awesome/css/font-awesome.css'
//@表示src
import api from '@/apis'
Vue.prototype.$http=axios
Vue.config.productionTip = false
//Vue.prototype.$baseURL=process.env.VUE_APP_ROOTAPI
Vue.prototype.$api=api
router.beforeEach((to,from,next)=>{
	if(to.path==='/signin'){
		localStorage.clear();
		next();
	}else{
		if(localStorage.getItem('token')){
			next();
		}else{
			next({path:'/signin',query:{redirect:to.path}})
		}
	} 
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
